package com.itguigu.glimail.ware.controller;

import com.itguigu.common.to.mq.StockLockedTo;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @GetMapping("/msg")
    public String msg() {
        StockLockedTo lockedTo = new StockLockedTo();
        lockedTo.setId(120L);
        rabbitTemplate.convertAndSend("stock-event-exchange","stock.locked",lockedTo);
        return "ok";
    }
}
